<%@ include file="/WEB-INF/views/taglib.jsp" %>
<h3>Ad-Hoc Form</h3>	
	<form:form id="form" method="post" modelAttribute="workOrderAdHoc"  cssClass="simpleForm">
		<form:hidden path="workOrderAdHocId" />
		<form:hidden path="adHocStatus" />
		
		<div class="clear" style="height:1px">&nbsp;</div>
		<jsp:include page="/WEB-INF/views/message.jsp"></jsp:include>
	  	<fieldset>
	  		<legend>Ad-Hoc Info</legend>
	  		<aims:column cssErrorClass="error" path="vehicleId" >
	  		<label>
	  			Taxi No  * 
	 		</label>
	  		<form:input path="vehicleId" id="vehicleId" /> <form:errors path="vehicleId"  cssClass="errorSimple" /> 
			</aims:column>
			<aims:column cssErrorClass="error" path="systemCodeValue.systemCodeValueId" >
	  		<label>
	  			Service Type * 
	 		</label>
	  		<form:select path="systemCodeValue.systemCodeValueId">
	  			<form:options items="${systemCodeValueList}" itemValue="systemCodeValueId" itemLabel="systemCodeValueDescription"/>
	  		</form:select>
	  		
	  		 <form:errors path="systemCodeValue.systemCodeValueId"  cssClass="errorSimple" /> 
			</aims:column>
			<aims:column cssErrorClass="error" path="appointmentDate" >
	  		<label>
	  			Appointment Date  * 
	 		</label>
	  		<form:input path="appointmentDate" id="f_date_0" />
	  		<input type="button" class="calendarBtn" id="f_btn_0" />
	  		 <form:errors path="appointmentDate"  cssClass="errorSimple" /> 
			</aims:column>
			<aims:column cssErrorClass="error" path="adHocRemarks" >
	  		<label>
	  			Remarks  * 
	 		</label>
	  		<form:textarea path="adHocRemarks" cols="40" />   <form:errors path="adHocRemarks"  cssClass="errorSimple" /> 
			</aims:column>
			
			</fieldset>
      <div class="action">
	  	<c:choose>
	  		<c:when test="${workOrderAdHoc.workOrderAdHocId==null}">
	  			<button type="submit" class="button positive">
	  			Save
	  			</button>
	  			<a href="<c:url value="/adHoc/search" />" class="button">Back</a>
	  		</c:when>
	  		<c:when test="${workOrderAdHoc.workOrderAdHocId!=null}">
  				<button type="submit"  class="button positive">
  				Update</button>
  				<a href="<c:url value="/adHoc/search" />" class="button">Back</a>
	  		</c:when>
	  	</c:choose>
	 </div>	
	</form:form>
	<script type="text/javascript">
		$(document).ready(function() {
			cal = Calendar.setup({
		          onSelect: function(cal) { cal.hide() },
		          showTime: true
		      });
			
			cal.manageFields("f_btn_0", "f_date_0", globalJsCalDateWithHourMinuteFormat);
			

			$("#vehicleId").autocomplete("<c:url value="/ajax/vehicle"></c:url>", {
		        dataType: 'json',
		        highlight: false,
		        scroll: true,
		        scrollHeight: 300,
		        autoFill: true,
				mustMatch: true,
		        parse: function(data) {
	                var array = new Array();
	                for(var i=0;i<data.length;i++)
	                {
	                    array[i] = { data: data[i], value: data[i].vehicleId, result: data[i].vehicleId };
	                }
	                return array;
		        },

		        formatItem: function(row) {
		             return row.vehicleId;
		        }
		    });
		});
		
		
	</script>